home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / Gui4Cli / G4C / CED / cedbar.gc < prev    next >
Encoding:
Gui4CLI script  |  1980-01-03  |  7.9 KB  |  266 lines

  1. G4C   - CygnusEd Rexx control centre
  2.  
  3. ; This is a simple program to show what you can do with the Rexx capability
  4. ; of Gui4Cli. You NEED the CygnusEd editor to run it.
  5.  
  6. ; If CygnusEd is not already running, I look for it under the name c:ced.
  7. ; Look below, in order to change it to your prefered name.
  8.  
  9. ; CygnusEd is a commercial product from :
  10. ; ASDG Inc., 925 Stewart str., Madison WI 53713, USA - Tel:(608)273-6585
  11.  
  12. ; What we do is define various icons, which we use as if they were buttons
  13. ; and send the appropriate rexx command to rexx_ced, which is the name of
  14. ; CygnusEd's first Rexx port.
  15.  
  16. ; CygnusEd MUST be running on a public screen (see it's preferences)
  17.  
  18. ; NOTE : You need to have GUIs: assigned, so I can find the icon & gui files!
  19.  
  20.  
  21.  
  22. WinBig -1 0 620 14 ""         ; note : no title - since don't want borders
  23. WinType 000010                ; a borderless window with no system gadgets
  24. Screen CygnusEdScreen1        ; open on CED screen
  25. UseTopaz              ; because it's a non-resizable window
  26.  
  27. xOnLoad                       ; On Loading set the default values...
  28. SetVar cedClip 0
  29. SetVar cedMark 1
  30. SetVar cedSend ""
  31. SetVar cedFile ""
  32. newflag = 0
  33. gosub cedbar.gc StartUpCed        ; See if ced is running, load it and open
  34. GuiLoad guis:g4c/ced/cedbar.g   ; This is the program for the small bar
  35. GuiLoad guis:g4c/ced/cedMark.g  ; This is the Mark Set/Go window
  36. guiload guis:tools/filereq.gc
  37.  
  38. xONQuit                      ; On Quitting delete variables..
  39. delvar cedClip
  40. delvar cedMark
  41. delvar cedSend
  42. delvar cedFile
  43. GuiQuit cedbar.g             ; and unload the other 2 GUIs
  44. GuiQuit cedmark.g
  45.  
  46.  
  47. ;*********************** Window Close & Open **************************
  48.  
  49. xOnRMB                        ; We also close on RMB (right mouse button)
  50. GuiClose cedbar.gc            ; You don't need this of course...
  51. GuiOpen cedbar.g              ; I'm just showing off :)
  52.  
  53. xIcon 2 0 guis:tools/icons/wnClose   ; Icon for closing window
  54. GuiClose cedbar.gc
  55.  
  56. xIcon 15 1 guis:tools/icons/right    ; Icon for togling big/small windows
  57. GuiClose cedbar.gc
  58. GuiOpen cedbar.g
  59.  
  60.  
  61. ;*********************** AppMenuItem ***********************************
  62. ; Here, when the user selects the AppMenuItem from the WB Tools menu, 
  63. ; we see if CygnusEd is running. If it's not, we fire it up, and then
  64. ; wait for its ARexx Port to appear so that we can open on it's screen.
  65. ; If CEd is not found, we notify the user and .. (exit stage left).
  66.  
  67.  
  68. xAppMenu GUI-Ced  "" ON     ; We set up an appmenu item - no need for files
  69. gosub cedbar.gc StartUpCed
  70.  
  71.  
  72. ;===============> This is the routine that will look for & start CygnusEd
  73.  
  74. xRoutine StartUpCed
  75. IfExists PORT rexx_ced
  76.   ; Don't do anything - ced is running
  77. else
  78.   RUN 'c:ced'                  ; *** CHANGE THIS TO YOUR CED NAME ****
  79.   Wait PORT rexx_ced 30               ; wait for ced to load
  80.   if $$RETCODE > 0
  81.      gosub cedbar.gc exit             ; if again not found, it's hopeless!
  82.   endif
  83.   Wait SCREEN CygnusEdScreen1 100     ; We also wait for the Public Screen
  84.   if $$RETCODE > 0                    ; (which opens after the port)
  85.      gosub cedbar.gc exit
  86.   endif
  87. endif
  88. GuiClose cedbar.g         ; Close the small window (just in case it was open)
  89. GuiOpen  cedbar.gc         ; Open big cedbar
  90. GuiScreen cedbar.gc FRONT  ; and bring the screen to the front
  91.  
  92.  
  93. ;===============> this is our exit routine
  94.  
  95. xRoutine exit
  96. ezreq "CygnusEd was not found!" EXIT ""
  97. GuiQuit cedbar.gc                          ; We quit (see xOnQuit)
  98. Stop                                       ; and stop, because if we
  99.                     ; didn't, then the gosub would return to the calling
  100.                     ; event, and would continue execution. "Stop" will
  101.                     ; stop execution immediately, wherever you are.
  102.                     ; The Gui will quit on its own, after all it's
  103.                     ; commands have been executed.
  104.  
  105.  
  106.  
  107. ;**************************** NEW/Open & next/prev Views **************
  108. ; From here on its a matter of declaring the icons and issuing the commands.
  109.  
  110. xIcon 32 0 guis:tools/icons/New
  111. SendRexx rexx_ced "open new"
  112. gosub cedbar.gc verify
  113.  
  114. xIcon 60 0 guis:tools/icons/Open
  115. setscreen filereq.gc CygnusEdScreen1 
  116. newflag = 0
  117. *GUI = cedbar.gc
  118. guiopen filereq.gc
  119.  
  120. xroutine LoadFile    ; routine called from the FileReq.gc gui
  121. if $newflag = 0
  122.    SendRexx rexx_ced "open $*FILENAME"
  123.    newflag = 1
  124. else
  125.    SendRexx rexx_ced "open new"
  126.    SendRexx rexx_ced "open $*FILENAME"
  127. endif
  128.  
  129. xIcon 88 0 guis:tools/icons/Big
  130. SendRexx rexx_ced "expand view"
  131. gosub cedbar.gc verify
  132.  
  133. xIcon 116 0 guis:tools/icons/Up
  134. SendRexx rexx_ced "grow view"
  135. gosub cedbar.gc verify
  136.  
  137. xIcon 116 8 guis:tools/icons/Down
  138. SendRexx rexx_ced "shrink view"
  139. gosub cedbar.gc verify
  140.  
  141. xIcon 141 1 guis:tools/icons/left
  142. SendRexx rexx_ced "next view"
  143. gosub cedbar.gc verify
  144.  
  145. xIcon 156 1 guis:tools/icons/right
  146. SendRexx rexx_ced "previous view"
  147. gosub cedbar.gc verify
  148.  
  149. ;************************ CUT-COPY-PASTE / Clipboard unit *************
  150.  
  151. xIcon 172 0 guis:tools/icons/cut
  152. SendRexx rexx_ced cut
  153. gosub cedbar.gc verify
  154.  
  155. xIcon 200 0 guis:tools/icons/copy
  156. SendRexx rexx_ced copy
  157. gosub cedbar.gc verify
  158.  
  159. xIcon 228 0 guis:tools/icons/paste
  160. SendRexx rexx_ced paste
  161. gosub cedbar.gc verify
  162.  
  163. xTextIn 256 0 40 14 "" cedClip 0 5    ; This shows the number of the clipboard
  164. GadID 1                               ; unit where your cut or copy will go.
  165. SetVar cedSend "set clipboard unit "
  166. AppVar cedSend $cedClip
  167. SendRexx rexx_ced $cedSend
  168. gosub cedbar.gc verify
  169.  
  170. xIcon 296 0 guis:tools/icons/Up      ; Gadgets to increase/decrease the clipboard
  171. counter cedClip INC 1         ; number. We use a counter to add/subtract
  172. if $cedClip > 255
  173.    SetVar cedClip 0
  174. endif
  175. Update cedbar.gc 1 $cedClip
  176. SetVar cedSend "set clipboard unit "
  177. AppVar cedSend $cedClip
  178. SendRexx rexx_ced $cedSend
  179. gosub cedbar.gc verify
  180.  
  181. xIcon 296 8 guis:tools/icons/Down
  182. counter cedClip DEC 1
  183. if $cedClip < 0
  184.    SetVar cedClip 255
  185. endif
  186. Update cedbar.gc 1 $cedClip
  187. SetVar cedSend "set clipboard unit "
  188. AppVar cedSend $cedClip
  189. SendRexx rexx_ced $cedSend
  190. gosub cedbar.gc verify
  191.  
  192. ;****************************** SAVE - SAVE.. - QUIT ************
  193.  
  194. xIcon 320 0 guis:tools/icons/save
  195. SendRexx rexx_ced "save"
  196. gosub cedbar.gc verify
  197.  
  198. xIcon 348 0 guis:tools/icons/saveas
  199. SendRexx rexx_ced "save as"
  200. gosub cedbar.gc verify
  201.  
  202. xIcon 376 0 guis:tools/icons/quit
  203. SendRexx rexx_ced "quit"
  204. gosub cedbar.gc verify
  205.  
  206. xIcon 404 0 guis:tools/icons/Clear
  207. SendRexx rexx_ced "clear"
  208. gosub cedbar.gc verify
  209.  
  210. ;***************************** UNDO/REDO - {} - SEARCH/REPL ***********
  211.  
  212. xIcon 432 0 guis:tools/icons/undo
  213. SendRexx rexx_ced "undo"
  214. gosub cedbar.gc verify
  215.  
  216. xIcon 460 0 guis:tools/icons/redo
  217. SendRexx rexx_ced "redo"
  218. gosub cedbar.gc verify
  219.  
  220. xIcon 488 0 guis:tools/icons/brackets
  221. SendRexx rexx_ced "find matching bracket"
  222. gosub cedbar.gc verify
  223.  
  224. xIcon 516 0 guis:tools/icons/find
  225. SendRexx rexx_ced "search for"
  226. gosub cedbar.gc verify
  227.  
  228. xIcon 544 1 guis:tools/icons/right
  229. SendRexx rexx_ced "repeat search forwards"
  230. gosub cedbar.gc verify
  231.  
  232. xIcon 559 0 guis:tools/icons/replace
  233. SendRexx rexx_ced "replace"
  234. gosub cedbar.gc verify
  235.  
  236. xIcon 587 1 guis:tools/icons/right
  237. SendRexx rexx_ced "repeat replace"
  238. gosub cedbar.gc verify
  239.  
  240. ;************************** Open Mark window ************************
  241.  
  242. xIcon 602 0 guis:tools/icons/link
  243. GuiOpen cedmark.g
  244.  
  245. ;**************************** ROUTINE VERIFY ************************
  246. ; A little routine to let the user know if the Rexx Command failed.
  247.  
  248. xRoutine Verify
  249. if $$Retcode > 0
  250.   ezreq "CygnusEd was not found!" OK ""
  251. endif
  252.  
  253. ;**************************** END of Program *************************
  254. ; ... and begining of advertisements :)
  255.  
  256. ; I have now been using this GUI for so long that I can not imagine
  257. ; using CED without it. It really works nicely.
  258.  
  259. ; The good thing about the above program, is that you can move the gadgets
  260. ; around, add or remove them and generally adgust the GUI to your liking
  261. ; without having to compile, recompile, swear or sweat!
  262.  
  263. ; According to your monitor/resolution/font etc the Icon-buttons may be too
  264. ; small or too big - just redesign them to your liking.
  265.  
  266.